#define _CRT_SECURE_NO_WARNINGS 1
#include <iostream>

using namespace std;

const int N = 100010;

int n;
int q[N], s[N];

int main()
{
    scanf("%d", &n);
    for (int i = 0; i < n; i++) scanf("%d", &q[i]);

    int res = 0;
    for (int i = 0, j = 0; i < n; i++)
    {
        s[q[i]] ++;
        while (j < i && s[q[i]] > 1) s[q[j++]] --;
        res = max(res, i - j + 1);
    }

    cout << res << endl;

    return 0;
}
#include <iostream>
#include <cstdio>
using namespace std;

const int N = 1e5 + 10;

int n, m, k;
int a[N], b[N];
#define read(x) scanf("%d",&x)

int main()
{
    read(n), read(m), read(k);
    for (int i = 0; i < n; i++) read(a[i]);
    for (int i = 0; i < m; i++) read(b[i]);

    for (int i = 0, j = m - 1; i < n; i++) {
        while (j >= 0 && a[i] + b[j] > k) j--;
        if (j >= 0 && a[i] + b[j] == k) printf("%d %d\n", i, j);
    }
    return 0;
}